<?php
loadTemp("admin/models/member/member_header.php");
?>
<script type="text/javascript">
$(document).ready(function(){
	loadAdminTopItem();
	activeAdminTopItem("s_c_add_user");
});
</script>
<?php checkAdminPermission("admin.member.add_user","admin.class.*");?>
<!-- Start -->
<script type="text/javascript">
$(document).ready(function(){
	bindAjaxForm($("#form_add_user"),s_adduser_onSuccess,s_adduser_onError,"admin_di");
	$(".s_master_selecter").hide();
});
function s_adduser_onSuccess(data){
	console.log(data);
	s_adduser_operatedone(data.code,data.message,data.data);
}
function s_adduser_onError(data){
	console.log(data);
	s_adduser_operatedone(-101,"服务器返回了未知的数据，请上报管理员",data.responseText);
}
function s_adduser_operatedone(id,message,data){
	if(id==-101){
		showMessage("s_adduser_message",-101,message+"<br><br><pre>"+data+"</pre>");
		return;
	}
	if(id!=0&&id!=3){
		showMessage("s_adduser_message",id,message);
	}
	if(id==0){
		showMessage("s_adduser_message",id,message);
	}
}
</script>
<div class="s_admin_in_container">
	<h2 class="ui dividing header">添加成员</h2>
	<div class="ui message">
		<div class="header">小提示</div>
		<ul class="list">
			<li>密码需要超过6位</li>
			<li>邮箱或手机必须是未注册过的</li>
			<li>邮箱或手机可以只填写一个</li>
		</ul>
	</div>
	<div class="ui message hidden" id="s_adduser_message"></div>
	<form class="ui form admin_form" url="admin.php?mod=member&ajax=true&op=add_user" id="form_add_user">
		<h4 class="ui dividing header">添加用户</h4>
		<div class="field">
			<label>邮箱</label>
			<div class="field">
				<input id="mail" type="text" name="mail" placeholder="邮箱">
			</div>
			<label>手机号</label>
			<div class="field">
				<input id="phonenumber" type="text" name="phonenumber" placeholder="手机号">
			</div>
			<label>密码</label>
			<div class="field">
				<input id="password" type="password" name="passwd" placeholder="密码">
			</div>
		</div>
		<button type="submit" class="ui submit button" tabindex="0">提交</button>
	</form>
</div>